package org.future.dataanalysis.bean;

import lombok.Data;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;

/**
 * @author Dongwei-Chen
 * @Date 2023/12/18 16:32
 * @Description
 */
@Data
public class Node implements Serializable {

    public Node(Type type) {
        this.type = type;
    }

    public Node putDataField(String field, String targetField) {
        if (dataMap == null) {
            dataMap = new HashMap<>();
        }
        dataMap.put(field, targetField);
        return this;
    }

    public void putObjMap(String field, Node node) {
        if (objMap == null) {
            objMap = new HashMap<>();
        }
        objMap.put(field, node);
    }

    public void putNodeMap(String field, Node node) {
        if (nodeMap == null) {
            nodeMap = new HashMap<>();
        }
        nodeMap.put(field, node);
    }

    private Type type;

    private boolean flat;

    private Map<String, String> dataMap;

    private Map<String, Node> objMap;

    private Map<String, Node> nodeMap;

}
